package com.aspose.cells;

import java.util.ArrayList;

final class zbsy {
   static int[] a(Shape var0) throws Exception {
      MsoTextFrame var1 = var0.getTextFrame();
      int var2 = a(a(var0, var1.getLeftMarginPt()));
      int var3 = a(a(var0, var1.getRightMarginPt()));
      int var4 = a(a(var0, var1.getTopMarginPt()));
      int var5 = a(a(var0, var1.getBottomMarginPt()));
      int var6 = var0.getWidth() - var2 - var3;
      if (!var0.aa().d) {
         var6 = Integer.MAX_VALUE;
      }

      new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);
      zbtz var8 = var0.aa();
      com.aspose.cells.b.a.b.zg var9 = a(var8.k());
      com.aspose.cells.b.a.b.zt var7;
      if (!var8.q()) {
         com.aspose.cells.b.a.b.za var10 = new com.aspose.cells.b.a.b.za(1, 1);

         try {
            com.aspose.cells.b.a.b.zi var11 = com.aspose.cells.b.a.b.zi.a((com.aspose.cells.b.a.b.zj)var10);

            try {
               com.aspose.cells.b.a.b.zv var12 = new com.aspose.cells.b.a.b.zv(com.aspose.cells.b.a.b.zv.c());
               var7 = var11.a(var8.i(), var9, var6, var12);
            } finally {
               if (var11 != null) {
                  var11.d();
               }

            }
         } finally {
            if (var10 != null) {
               var10.b();
            }

         }
      } else {
         zbam var33 = new zbam();
         zjo var35 = new zjo((ImageOrPrintOptions)null);
         var35.a((ArrayList)var8.p(), (String)var8.i(), (zahq)var33);
         zbai var37 = new zbai();
         var37.a(0);
         var37.b(0);
         com.aspose.cells.b.a.b.zq var13 = new com.aspose.cells.b.a.b.zq(0.0F, 0.0F, (float)var6, 2.14748365E9F);
         zbaq var14 = new zbaq(var13, var37, var33, var9);
         int var15 = zadb.b;
         zbkr var16 = new zbkr(6);
         com.aspose.cells.b.a.d.zh var17 = new com.aspose.cells.b.a.d.zh();

         try {
            zn var18 = zadb.a(var15, 1, 1, ImageFormat.getBmp(), (ImageOrPrintOptions)null, var17, var16);
            com.aspose.cells.b.a.b.zq var19 = var14.a(var18);
            var7 = var19.e();
         } finally {
            if (var17 != null) {
               var17.a();
            }

         }
      }

      int var34 = var0.getWidth();
      if (!var0.aa().d) {
         var34 = a((double)((float)(var2 + var3) + var7.b()));
         if (var2 + var3 != 0) {
            var34 += 3;
         }
      }

      int var36 = a((double)((float)(var4 + var5) + var7.c()));
      if (var4 + var5 != 0) {
         var36 += 3;
      }

      return new int[]{var34, var36};
   }

   private static com.aspose.cells.b.a.b.zg a(Font var0) throws Exception {
      int var1 = 0;
      if (var0.isBold()) {
         var1 |= 1;
      }

      if (var0.isItalic()) {
         var1 |= 2;
      }

      if (var0.isStrikeout()) {
         var1 |= 8;
      }

      if (var0.getUnderline() != 0) {
         var1 |= 4;
      }

      double var2 = var0.getDoubleSize();

      try {
         return new com.aspose.cells.b.a.b.zg(var0.getName(), (float)var2, var1);
      } catch (Exception var6) {
         com.aspose.cells.a.d.zfq var5 = com.aspose.cells.a.d.zfs.b(var0.getName(), var1, false);
         return new com.aspose.cells.b.a.b.zg(var0.getName(), (float)var2, var5.g());
      }
   }

   private static double a(Shape var0, double var1) {
      return var1 * (double)(var0.L().L() / 72);
   }

   static int a(double var0) {
      return (int)Math.ceil(var0);
   }
}
